package com.hhf.feiojapiservice.fallback;

import com.hhf.feiojapiservice.client.QuestionFeignClient;
import com.hhf.feiojcommonservice.model.entity.Question;
import com.hhf.feiojcommonservice.model.entity.QuestionSubmit;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

/**
 * @Author hhf
 * @Date 2024/11/3
 * @Description
 */
@Slf4j
public class QuestionClientFallbackFactory implements FallbackFactory<QuestionFeignClient> {
    @Override
    public QuestionFeignClient create(Throwable cause) {
        return new QuestionFeignClient() {
            @Override
            public Question getQuestionById(long questionId) {
                log.error("QuestionFeignClient getQuestionById error:{}",cause.getMessage());
                return null;
            }

            @Override
            public boolean updateById(QuestionSubmit questionSubmit) {
                log.error("QuestionFeignClient updateById error:{}",cause.getMessage());
                return false;
            }

            @Override
            public QuestionSubmit getQuestionSubmitById(long questionSubmitId) {
                log.error("QuestionFeignClient getQuestionSubmitById error:{}",cause.getMessage());
                return null;
            }

        };
    }
}
